package mychat.server;

import java.util.ArrayList;

public class ProcessorList {
	private ArrayList<ClientProcessor> list=new ArrayList<ClientProcessor>();

	public void addClient(ClientProcessor c) {
		list.add(c);
	}

	public ClientProcessor getProcessor(String name) {
		for (ClientProcessor c : list) {
			if (c.getUserName().equals(name))
				return c;
		}
		return null;
	}

	public String toString() {
		StringBuffer str = new StringBuffer();
		for (ClientProcessor c : list) {
			str.append(c.getUserName()).append(',')
					.append(c.getUser().getEmail()).append(';');
		}
		return str.toString();
	}
}
